<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('kh rule list')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="form">
					<input type="hidden" id="pageFlag" name="pageFlag" th:value="${khRule.pageFlag}"/>
					<input type="hidden" id="kh.type" name="kh.type" value="DB"/>
					<div class="select-list">
						<ul>
							<li class="select-time">
								<label>考评月份： </label>
								<input type="text" class="" id="kh.monthId" name="kh.monthId" th:value="${khRule.kh.monthId}"/>
							</li>
							<li>
								考核组：
								<select name="kh.khz" id="kh.khz" th:with="dicts=${@dict.getType('rate_khz')}">
									<option value="">--请选择--</option>
									<option th:each="dict : ${dicts}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" />
								</select>
							</li>
							<li th:if="${'ALL' == khRule.pageFlag || 'OUT' == khRule.pageFlag}">
								被考核单位：
								<select name="kh.dept.deptId" id="kh.dept.deptId">
									<option value="">--请选择--</option>
									<option th:each="dept : ${deptList}" th:text="${dept.deptName}" th:value="${dept.deptId}" />
								</select>
							</li>
							<!-- 
							<li>
								类型：
								<select name="kh.type" id="kh.type" th:with="dicts=${@dict.getType('rate_kh_type')}">
									<option value="">--请选择--</option>
									<option th:each="dict : ${dicts}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" />
								</select>
							</li>
							<li>
								<label>序号： </label>
								<input type="text" id="xh" name="xh" />
							</li>
							 -->
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a style="margin-left:20px;" class="btn btn-warning btn-rounded btn-sm" onclick="doExport()">
									<i class="fa fa-download"></i> 导出
								</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<th:block th:include="include :: datetimepicker-css" />
	<th:block th:include="include :: datetimepicker-js" />
	<script th:inline="javascript">
		var prefix = ctx + "rate/khRule";
		var khzDict = [[${@dict.getType('rate_khz')}]];
		var typeDict = [[${@dict.getType('rate_kh_type')}]];

		$(function() {
			$("#kh\\.monthId").datetimepicker({
				format: 'yyyy-mm',
				weekStart: 1,
				autoclose: true,
				startView: 3,
				minView: 3
			});
			list();
		});

		function list() {
			var cols = [];
			cols.push({
				field: 'id',
				visible: false
			});
			/**
			cols.push({
				field: 'monthId',
				align: 'center',
				title: '考评月份'
			});
			**/
			cols.push({
				field: 'kh.khz',
				align: 'center',
				title: '考核组',
				formatter: function(value, row, index) {
					return $.table.selectDictLabel(khzDict, value);
				}
			});
			cols.push({
				field: 'kh.createDept.deptName',
				align: 'center',
				title: '提交<br/>部门'
			});
			cols.push({
				field: 'kh.dept.deptName',
				align: 'center',
				title: '被考核<br/>部门'
			});
			cols.push({
				field: 'kh.type',
				align: 'center',
				title: '类型',
				formatter: function(value, row, index) {
					return $.table.selectDictLabel(typeDict, value);
				}
			});
			cols.push({
				field: 'lb',
				align: 'center',
				title: '类别',
				formatter: function(value, row, index) {
					var spanBegin = "<span>";
					var spanEnd = "</span>";
					return spanBegin + value + spanEnd;
				}
			});
			cols.push({
				field: 'xm',
				align: 'center',
				title: '项目',
				formatter: function(value, row, index) {
					var spanBegin = "<span>";
					var spanEnd = "</span>";
					return spanBegin + value + spanEnd;
				}
			});
			cols.push({
				field: 'xh',
				align: 'center',
				title: '序号'
			});
			cols.push({
				field: 'fz',
				align: 'center',
				title: '分值'
			});
			cols.push({
				field: 'nr',
				align: 'center',
				title: '内容及标准',
				formatter: function(value, row, index) {
					var spanBegin = "<span>";
					var spanEnd = "</span>";
					return spanBegin + value + spanEnd;
				}
			});
			cols.push({
				field: 'fs',
				align: 'center',
				title: '方式',
				formatter: function(value, row, index) {
					var spanBegin = "<span>";
					var spanEnd = "</span>";
					return spanBegin + value + spanEnd;
				}
			});
			cols.push({
				field: 'kf',
				align: 'center',
				title: '扣分'
			});
			cols.push({
				field: 'remark',
				align: 'center',
				title: '扣分原因',
				formatter: function(value, row, index) {
					var spanBegin = "<span>";
					var spanEnd = "</span>";
					return spanBegin + value + spanEnd;
				}
			});
			cols.push({
				field: 'zrr',
				align: 'center',
				title: '责任人',
				formatter: function(value, row, index) {
					var spanBegin = "<span>";
					var spanEnd = "</span>";
					return spanBegin + value + spanEnd;
				}
			});
			/**
			cols.push({
				field: 'kh.createUser.userName',
				align: 'center',
				title: '提交人'
			});
			cols.push({
				field: 'kh.createTime',
				align: 'center',
				title: '提交时间'
			});
			**/
			
			var options = {
				url: prefix + "/listForKf",
				exportUrl: prefix + "/export",
				modalName: "扣分情况",
				columns: cols,
				pagination: false
			};
			$.table.init(options);
		}
		
		function doExport() {
			if ($("#kh\\.monthId").val() == '') {
				$.modal.alertWarning("请选择考核月份！");
				return false;
			}
			$.table.exportExcel();
		}
	</script>
</body>
</html>